import Taro, { Component } from '@tarojs/taro'
import { Image, View } from '@tarojs/components'
import classNames from 'classnames'
// import './index.scss'
import styles from './index.module.scss'
import emptyData from "@/assets/icon/empty-data.png"
import emptyOrder from "@/assets/icon/empty-order.png"
import emptyCollect from "@/assets/icon/empty-collect.png"
import emptyNetwork from "@/assets/icon/empty-network.png"

interface IProps {
  type?: string
}

export default class ListEmpty extends Component<IProps, {}> {
  props: any
  constructor () {
    super(...arguments)
    this.state = {
      images: {
        order: { title: '暂无订单', src: emptyOrder },
        record: { title: '暂无记录', src: emptyData },
        collect: { title: '暂无收藏', src: emptyCollect },
        network: { title: '暂无网络', src: emptyNetwork },
      }
    }
  }

  static options = {
    addGlobalClass: true
  }

  render() {
    const prefixCls = 'list-empty'
    const { images }:any = this.state
    const { type='record', className } = this.props

    return (
      <View className={classNames(styles[prefixCls], className)}>
        <View className={styles[`${prefixCls}-box`]}>
          <Image className={styles[`${prefixCls}-img`]} src={images[type]['src']}/>
          <View className={styles[`${prefixCls}-text`]}>{images[type]['title']}</View>
        </View>
      </View>
    )
  }
}
